#include "stdafx.h"
#include "stdio.h"
#include "InterMotion.h"
#include "InterHjim.h"

static char* strInfo = "Hjim Driver R1.0";
InterHjim* pHjimMotion = nullptr;

TAMI_API void MotionDriver_Info(char* pInfo)
{
	if (pInfo)
		strcpy_s(pInfo, MAX_PATH,strInfo);
}

TAMI_API bool MotionDriver_Init(int nIndex, CB_TAMI_MOTION pFunc)
{
	printf("MotionDriver_Init: %d\n", nIndex);
	if ( !pHjimMotion)
	{
		pHjimMotion = new InterHjim();
		if(pFunc)
			pHjimMotion->m_cb_motion = pFunc;
		return pHjimMotion->Init(nIndex);
	}
	return true;
}

TAMI_API bool MotionDriver_GetData(std::list< std::shared_ptr<Tami_MotionData> >& pDataList)
{
	if (pHjimMotion)
	{
		pHjimMotion->GetData(pDataList);
	}
	return false;
}

TAMI_API void MotionDriver_SetState(bool bPause)
{
	if (pHjimMotion)
	{
		pHjimMotion->m_bPause = bPause;
	}
}

TAMI_API bool MotionDriver_State()
{
	if (pHjimMotion)
	{
		return pHjimMotion->m_bPause;
	}
	return false;
}

TAMI_API void MotionDriver_Exit()
{
	if (pHjimMotion)
	{
		pHjimMotion->m_bExit = true;
	}
}
